1 using System;
2 using
System.Collections.Generic;
3 using
System.ComponentModel;
4 using
System.Data;
5 using
System.Drawing;
6 using
System.Linq;
7 using
System.Text;
8 using
System.Windows.Forms;
9 using
System.Data.SqlClient;
10 using
Telerik.WinControls;
11 using
Telerik.Data;
12 using
QuanLyNhanSu.Class;
13 namespace
QuanLyNhanSu
14 {
15     
public partial class frmDMHieuQua : RadForm
16     {
17         clshieuqua c =
new clshieuqua();
18         
int k = 0;
19         
public frmDMHieuQua()
20         {
21             InitializeComponent();
22             c.laydl(
"tbl_hieuqua");
23             txtmahq.DataBindings.Add(
"text", c.ds, "tbl_hieuqua.Mahieuqua");
24             txtphucap.DataBindings.Add(
"text", c.ds, "tbl_hieuqua.phucap");
25             dgv_DMhieuqua.DataSource = c.ds;
26             dgv_DMhieuqua.DataMember =
"tbl_hieuqua";
27             dgv_DMhieuqua.Columns[
0].HeaderText = "Mã hiệu quả";
28             dgv_DMhieuqua.Columns[
1].HeaderText = "Tỉ lệ lương";
29         }
30         
31         
public void setbutton(bool b)
32         {
33             cmdCapnhat.Enabled = b;
34             cmdthem.Enabled = b;
35             cmdthoat.Enabled = b;
36             cmdxoa.Enabled = b;
37             cmdluu.Enabled = !b;
38         }
39         
private void cmdthoat_Click(object sender, EventArgs e)
40         {
41             Close();
42         }
43
44         
private void frmDMHieuQua_Load(object sender, EventArgs e)
45         {
46             setbutton(
true);
47         }
48
49         
private void cmdthem_Click(object sender, EventArgs e)
50         {
51             txtmahq.Text =
"";
52             txtphucap.Text =
"0";
53             txtmahq.ReadOnly =
false;
54             txtphucap.ReadOnly =
false;
55             txtmahq.Focus();
56             setbutton(
false);
57             k =
1;
58         }
59         
private void cmdxoa_Click(object sender, EventArgs e)
60         {
61             
if (dgv_DMhieuqua.SelectedRows.Count == 0)
62             {
63                 RadMessageBox.Show(
"\nBạn phải chọn dòng để xóa !\n", "Thông Báo", MessageBoxButtons.OK, RadMessageIcon.Exclamation);
64                 
return;
65             }
66             
else
67             {
68                 DialogResult rs = RadMessageBox.Show(
"\nBạn thật sực muốn xóa thông tin này không ?\n", "Thông Báo", MessageBoxButtons.YesNo, RadMessageIcon.Question);
69                 
if (rs == DialogResult.Yes)
70                 {
71                     c.xoa(
"tbl_hieuqua", txtmahq.Text.Trim(), "mahieuqua",2);
72                     c.laydl(
"tbl_hieuqua");
73                     
74                 }
75             }
76         }
77
78         
private void cmdCapnhat_Click(object sender, EventArgs e)
79         {
80             
if (dgv_DMhieuqua.SelectedRows.Count == 0)
81             {
82                 RadMessageBox.Show(
"\nBạn phải chọn dòng để cập nhật !\n", "Thông Báo", MessageBoxButtons.OK, RadMessageIcon.Exclamation);
83                 
return;
84             }
85             
else
86             {
87                 txtphucap.ReadOnly =
false;
88                 txtphucap.Focus();
89                 setbutton(
false);
90                 k =
2;
91             }
92         }
93
94         
private void cmdluu_Click(object sender, EventArgs e)
95         {
96             DialogResult rs = RadMessageBox.Show(
"\nBạn thật sự muốn lưu thông tin này không ?\n", "Thông Báo", MessageBoxButtons.YesNo, RadMessageIcon.Question);
97             
if (rs == DialogResult.Yes)
98             {
99                 
if (k == 1)
100                 {
101                     
if (txtmahq.Text == "" || txtphucap.Text == "")
102                     {
103                         RadMessageBox.Show(
this, "\nBạn phải nhập đầy đủ thông tin vào !\n", "Thông báo", MessageBoxButtons.OK, RadMessageIcon.Exclamation);
104                         
return;
105                     }
106                     
else
107                     {
108                         c.them(
"tbl_hieuqua",txtmahq.Text.Trim(),
109                             txtphucap.Text !=
""?double.Parse(txtphucap.Text.Trim()):1);
110                         c.laydl(
"tbl_hieuqua");
111                     }
112                 }
113                 
else if (k == 2)
114                 {
115                     
if (txtmahq.Text == "" || txtphucap.Text == "")
116                     {
117                         RadMessageBox.Show(
this, "\nBạn phải nhập đầy đủ thông tin vào !\n", "Thông báo", MessageBoxButtons.OK, RadMessageIcon.Exclamation);
118                         
return;
119                     }
120                     
else
121                     {
122                         c.sua(
"tbl_hieuqua", txtmahq.Text.Trim(), txtphucap.Text != "" ? double.Parse(txtphucap.Text.Trim()) : 1,
123                             
"mahieuqua", "phucap");
124                     }
125
126                 }
127             }
128             txtmahq.ReadOnly =
true;
129             txtphucap.ReadOnly =
true;
130             k =
0;
131             setbutton(
true);
132         }
133     }
134 }



Quản lý nhân sự công ty bằng c# _ full source code 60.353 lượt xem

Gõ tìm kiếm nhanh...